package com.xyy.saas.payment.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
 * @author wangzeqi
 */
public class ListUtils {

    @SafeVarargs
    public static <T> List<T> mergeLists(List<T>... lists) {
        List<T> allItems = new ArrayList<>();

        for (List<T> list : lists) {
            allItems.addAll(Optional.ofNullable(list).orElse(Collections.emptyList()));
        }

        return allItems;
    }

}
